import React, { Component } from 'react'
import Todo from './Todo'
// 任务列表组件
class TodoList extends Component {
  constructor(props) {
    super(props)
  }
  delItem = (id) => {
    // 子传父
    this.props.del(id)
  }
  mychange = (id) => {
    this.props.changeItem(id)
  }
  render () {
    return (
      <div className="todoList">
        {
          this.props.todos.map((item, index) => {
            return <Todo toChange={this.mychange} toDel={this.delItem} key={item.id} todoItem={item} />
          })
        }
      </div>
    )
  }
}
export default TodoList